Skip to content

fix: preserve selections when config import is invalid - #4994

Merged
ChrisTitusTech merged 4 commits into
ChrisTitusTech:mainfrom
Suze021:fix/atomic-config-import
Aug 19, 2026
Merged

fix: preserve selections when config import is invalid#4994
ChrisTitusTech merged 4 commits into
ChrisTitusTech:mainfrom
Suze021:fix/atomic-config-import

Conversation

@Suze021

@Suze021 Suze021 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • validate every imported selection before replacing the current selection state
  • reject unsupported and unknown selection keys without leaving partial selections behind
  • add coverage for valid replacement and invalid import preservation

Validation

  • ./Compile.ps1`n- Invoke-Pester -Path 'pester/*.Tests.ps1' -Output Detailed -CI (552 passed)

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d3ccd8ff-46f5-43d0-88b3-ac020416aeb5

📥 Commits

Reviewing files that changed from the base of the PR and between afd1007 and 45f909c.

📒 Files selected for processing (1)
  • docs/src/content/docs/guides/automation.mdx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved configuration imports by validating all selections before applying changes.
    • Invalid or unsupported selections no longer leave the app partially updated.
    • Imported configurations now replace existing selections cleanly.
    • Successful imports consistently reset the related UI state.
  • Documentation
    • Added guidance for handling configurations with removed or renamed catalog entries.
  • Tests
    • Added coverage for successful imports, invalid configurations, selection preservation, and UI reset behavior.

Walkthrough

Update-WinUtilSelections validates imported selection keys before updating state. Invoke-WPFImpex uses atomic replacement during imports. Tests and documentation cover valid imports, invalid imports, preserved state, and UI reset behavior.

Changes

Selection import state

Layer / File(s) Summary
Selection validation and replacement
functions/private/Update-WinUtilSelections.ps1
The function requires a typed selection array, validates category prefixes and keys, and supports append or replacement behavior.
Validated import integration
functions/public/Invoke-WPFImpex.ps1, docs/src/content/docs/guides/automation.mdx
The import path uses -Replace instead of clearing selection lists first. The guide documents stale-key import failures and recovery steps.
Import behavior coverage
pester/ui-state.Tests.ps1
Tests add WPF and catalog fixtures and verify replacement imports, invalid-import preservation, error logging, and checkbox reset behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 45f90

The import behavior is covered for valid replacement and invalid-import preservation, and no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant InvokeWPFImpex
  participant UpdateWinUtilSelections
  participant SelectionState
  InvokeWPFImpex->>UpdateWinUtilSelections: Import flattened selection keys with -Replace
  UpdateWinUtilSelections->>SelectionState: Validate keys and collect typed lists
  UpdateWinUtilSelections->>SelectionState: Replace synchronized selections
Loading

Possibly related PRs

Suggested labels: bug

Suggested reviewers: christitustech

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: preserving selections when a configuration import is invalid.
Description check ✅ Passed The description directly explains selection validation, invalid import handling, test coverage, and validation results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the bug Something isn't working label Aug 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: afd100756c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread functions/private/Update-WinUtilSelections.ps1

@ChrisTitusTech ChrisTitusTech left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the atomic import behavior, focused regression coverage, and stale-key documentation. Local validation and repository checks pass; the addressed review thread is resolved.

@ChrisTitusTech
ChrisTitusTech merged commit 792122e into ChrisTitusTech:main Aug 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants